﻿using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using SuperSocket;
using SuperSocket.ProtoBase;
using SuperSocket.Command;
using System.Threading.Tasks;

namespace Telnet
{
    internal class Program
    {
        private static async Task Main(string[] args)
        {
            var host = SuperSocketHostBuilder.Create<StringPackageInfo, CommandLinePipelineFilter>()
              .ConfigureLogging(loggingBuilder =>
              {
                  loggingBuilder.AddConsole();
              }).ConfigureSuperSocket(options =>
              {
                  options.Name = "Echo Server";
                  options.Listeners = new ListenOptions[] {
                         new ListenOptions {
                            Ip = "Any",
                           Port = 4040
                         }
                  };
              }).UseCommand<string, StringPackageInfo>((cmdOptions) =>
              {
                  //cmdOptions.AddCommand<ADD>();//注册单个
                  cmdOptions.AddCommandAssembly(typeof(Program).Assembly);//注册所有
              }).Build();
            await host.RunAsync();
        }
    }
}